import javax.swing.ImageIcon;


public class CommunityChest extends Block{
	private ImageIcon[] ii;
	private String myName = super.getMyName();
	public CommunityChest(String name, int Location) {
		super(name, Location);
		ii = new ImageIcon[16];
		//for (int i = 0; i < 16; i++) {
			//ii[i] = new ImageIcon("images/advance-to-go.gif");
		//}
		
		ii[0] = new ImageIcon("images/Scroll/community1.gif");
		ii[1] = new ImageIcon("images/Scroll/community2.gif");
		ii[2] = new ImageIcon("images/Scroll/community15.gif");
		ii[3] = new ImageIcon("images/Scroll/community7.gif");
		ii[4] = new ImageIcon("images/Scroll/community5.gif");
		ii[5] = new ImageIcon("images/Scroll/community6.gif");
		ii[6] = new ImageIcon("images/Scroll/community4.gif");
		ii[7] = new ImageIcon("images/Scroll/community8.gif");
		ii[8] = new ImageIcon("images/Scroll/community9.gif");
		ii[9] = new ImageIcon("images/Scroll/community12.gif");
		ii[10] = new ImageIcon("images/Scroll/community1.gif");
		ii[11] = new ImageIcon("images/Scroll/community16.gif");
		ii[12] = new ImageIcon("images/Scroll/community14.gif");
		ii[13] = new ImageIcon("images/Scroll/community13.gif");
		ii[14] = new ImageIcon("images/Scroll/community3.gif");
		ii[15] = new ImageIcon("images/Scroll/community11.gif");
	}
	
	public void setMyName(String myName) {
		this.myName = myName;
	}
	
	public String getMyName() {
		return myName;
	}
	
	public void getNumber(Player[] player, Integer[] orderTurn, int turn, int Location, int Chest, monopolyGUI ui){
		switch(Chest){
			case 1:
				ui.setUI(ii[0]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
		
			case 2:
				ui.setUI(ii[1]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+2000000);
				break;
					
			case 3:
				ui.setUI(ii[2]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-100000);
				break;
					
			case 4:
				ui.setUI(ii[3]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-500000);
				break;
					
			case 5:
				ui.setUI(ii[4]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+200000);
				break;
					
			case 6:
				ui.setUI(ii[5]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+250000);
				break;
					
			case 7:
				ui.setUI(ii[6]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-500000);
				break;
					
			case 8:
				ui.setUI(ii[7]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-1000000);
				break;
					
			case 9:
				ui.setUI(ii[8]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
					
			case 10:
				ui.setUI(ii[9]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+500000);
				break;
					
			case 11:
				ui.setUI(ii[10]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
					
			case 12:
				ui.setUI(ii[11], true, 1);
				ui.setnCounter1(0);
				break;
					
			case 13:
				ui.setUI(ii[12], true, 0);
				ui.setnCounter1(0);
				break;
					
			case 14:
				ui.setUI(ii[13]);
				ui.setToJail(true);
				player[orderTurn[turn]].setJail(true);
				ui.setnCounter1(player[orderTurn[turn]].getToken().getLocation());
				break;
					
			case 15:
				ui.setUI(ii[14]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()- 100000);
				break;
					
			case 16:
				ui.setUI(ii[15]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+ 100000 * orderTurn.length);
				for(int i = 0; i<orderTurn.length; i++){
					player[orderTurn[i]].setMoney(player[orderTurn[i]].getMoney() - 100000);
				}
				break;
		}
	}
	public void getNumber(Player[] player, Integer[] orderTurn, int turn, int Location, int Chest, monopolySolo ui){
		switch(Chest){
			case 1:
				ui.setUI(ii[0]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
		
			case 2:
				ui.setUI(ii[1]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+2000000);
				break;
					
			case 3:
				ui.setUI(ii[2]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-100000);
				break;
					
			case 4:
				ui.setUI(ii[3]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-500000);
				break;
					
			case 5:
				ui.setUI(ii[4]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+200000);
				break;
					
			case 6:
				ui.setUI(ii[5]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+250000);
				break;
					
			case 7:
				ui.setUI(ii[6]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-500000);
				break;
					
			case 8:
				ui.setUI(ii[7]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-1000000);
				break;
					
			case 9:
				ui.setUI(ii[8]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
					
			case 10:
				ui.setUI(ii[9]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+500000);
				break;
					
			case 11:
				ui.setUI(ii[10]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
					
			case 12:
				ui.setUI(ii[11], true, 1);
				ui.setnCounter1(0);
				break;
					
			case 13:
				ui.setUI(ii[12], true, 0);
				ui.setnCounter1(0);
				break;
					
			case 14:
				ui.setUI(ii[13]);
				ui.setToJail(true);
				player[orderTurn[turn]].setJail(true);
				ui.setnCounter1(player[orderTurn[turn]].getToken().getLocation());
				break;
					
			case 15:
				ui.setUI(ii[14]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()- 100000);
				break;
					
			case 16:
				ui.setUI(ii[15]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+ 100000 * orderTurn.length);
				for(int i = 0; i<orderTurn.length; i++){
					player[orderTurn[i]].setMoney(player[orderTurn[i]].getMoney() - 100000);
				}
				break;
		}
	}
}